package com.woniu.user.client;

import com.woniu.result.Result;
import com.woniu.user.client.param.RegisterParam;
import com.woniu.user.client.param.UpdateUserInfoParam;
import com.woniu.user.client.result.UserResultInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;

/**
 * name是项目名，contextId是client的名字
 */
@FeignClient(contextId = "userInfoClient", name = "user")
public interface UserInfoClient {
    //登录
    @GetMapping("login")
    public Result login(@RequestParam("userPhone") String userPhone, @RequestParam("pwd") String pwd) throws UnknownHostException;

    //注册
    @PostMapping("register")
    public Result register(@RequestBody RegisterParam registerParam);

    //发送短信验证码
    @GetMapping("send")
    public Result sendCode(@RequestParam("phone") String phone);

    //修改信息
    @PostMapping("updateUserInfo")
    public Result updateUserInfo(@RequestBody UpdateUserInfoParam updateUserInfoParam);

    //查看用户信息
    @GetMapping("searchUserInfo")
    public Result<UserResultInfo> searchUserInfo(@RequestParam("userId") Integer userId);

    //文件上传
    @PostMapping("upload")
    public Result uploadFile(@RequestPart("file") MultipartFile file) throws Exception;

    //用户阅读消息
    @GetMapping("/userReadNotice")
    public Result userReadNotice(@RequestParam("userId") Integer userId,@RequestParam("noticeId") Integer noticeId);

    //查看订单状态
    @GetMapping("orderState")
    public Result orderState(@RequestParam("userId") Integer userId, @RequestParam("orderState") String orderState);

    //查看优惠券
    @GetMapping("receiveRecord")
    public Result receiveRecord(@RequestParam("userId") Integer userId, @RequestParam("state") String state);

    //查看足迹
    @GetMapping("getUserFoot")
    public Result getUserFoot(@RequestParam("userId") Integer userId);
}
